//企业管理的js

function selectQyxx(tplcode) {

	var title = "选择企业";
	if(tplcode == 'jzfqwczzpf' || tplcode == 'jzfqwczzxn'){
		title ="选择建设单位";
	}

  ExtElWin({id: 'selectQyxxWin', title: title, w: 650, h: 500, tplcode: tplcode});
}

function ExtElWin(f) {
  var w = 350;
  var h = 160;
  if (f.w) w = f.w;
  if (f.h) h = f.h;
  
  var qyxxGrid = new Ext.ux.grid.YwGrid({
    //iconCls: 'icon-print',
    region: 'center',
    layout: 'fit',
    tplcode: f.tplcode,
    //margins: '1 1 1 1',
    needSelectTbar: true,
    //needPrintBtn: true,
    url: '/yw-com-qyxx!dataList.action?templateCode='+f.tplcode,
    keyField: 'id',
    defaultSortField: 'sqrq',
    structure: [{
      name: 'id',
      hidden: true
    },{
      name: 'post',
      hidden: true
    },{
      name: 'qyjc',
      hidden: true
    },{
      name: 'qyphone',
      hidden: true
    },{
      name: 'cz',
      hidden: true
    },{
      name: 'frxm',
      hidden: true
    },{
      name: 'frphone',
      hidden: true
    },{
      name: 'frtel',
      hidden: true
    },{
      name: 'gszcdjh',
      hidden: true
    },{
      name: 'qydlyszh',
      hidden: true
    },{
      name: 'gszcdjyxq',
      hidden: true
    },{
      name: 'qydlyszyxq',
      hidden: true
    },{
      name: 'ywlxr',
      hidden: true
    },{
      name: 'ywlxphone',
      hidden: true
    },{
      name: 'ywlxrtel',
      hidden: true
    },{
      name: 'address',
      hidden: true
    },{
      name: 'email',
      hidden: true
    },{
      name: 'zczj',
      hidden: true
    },{
      name: 'csmj',
      hidden: true
    },{
      name: 'frzw',
      hidden: true
    },{
      name: 'zzdj',
      hidden: true
    },{
      name: 'zsbh',
      hidden: true
    },{
      name: 'jjlx',
      hidden: true
    },{
      name: 'qyRemarks',
      hidden: true
    },{
      name: 'rsJsry',
      hidden: true
    },{
      name: 'rsWxg',
      hidden: true
    },{
      name: 'rsTotal',
      hidden: true
    },{
      name: 'dwslJyrq',
      hidden: true
    },{
      name: 'dwslGyrq',
      hidden: true
    },{
      name: 'qylx',
      hidden: true
    },{
      name: 'zydm',
      hidden: true
    },{
      name: 'cls',
      hidden: true
    },{
      name: 'czzh',
      hidden: true
    },{
      name: 'sfyx',
      hidden: true
    },{
      name: 'templateCode',
      hidden: true
    },{
      name: 'sqdw',
      header: '企业名称'
    },{
      name: 'sqrq',
      header: '申请日期',
      width: 12
    }]
  });
  
  var store = qyxxGrid.store;
  var toolbar = qyxxGrid.toolbar;
  store.on('beforeload', function(){
    store.baseParams = {
      sqdw: toolbar.search_sqdw.getValue()
    };
  }, this);
  
  new Ext.Window({
    id        : f.id,
    title     : f.title,
    width     : w,
    height    : h,
    iconCls   : 'icon_title',
    layout    : 'fit',
    modal     : true,
    plain     : true,
    //autoDestroy : false,
    resizeable: false,
    items     : [qyxxGrid]
  }).show();
}

function selectCallback(params) {
  try {
    // 设施改动数据回填
    if (document.forms[0].qyid && params.r.get('id')) document.forms[0].qyid.value = params.r.get('id');
    if (document.forms[0].sqdw && params.r.get('sqdw')) document.forms[0].sqdw.value = params.r.get('sqdw');
    if (document.forms[0].sqdw_ && params.r.get('sqdw')) document.forms[0].sqdw_.value = params.r.get('sqdw');
    if (document.forms[0].qyname_khb && params.r.get('sqdw')) document.forms[0].qyname_khb.value = params.r.get('sqdw');
    if (document.forms[0].qyname_shb && params.r.get('sqdw')) document.forms[0].qyname_shb.value = params.r.get('sqdw');
    if (document.forms[0].sqrq && params.r.get('sqrq')) document.forms[0].sqrq.value = params.r.get('sqrq');
    if (document.forms[0].ywlxr && params.r.get('ywlxr')) document.forms[0].ywlxr.value = params.r.get('ywlxr');
    if (document.forms[0].ywlxr_ && params.r.get('ywlxr')) document.forms[0].ywlxr_.value = params.r.get('ywlxr');
    if (document.forms[0].ywlxphone && params.r.get('ywlxphone')) document.forms[0].ywlxphone.value = params.r.get('ywlxphone');
    if (document.forms[0].ywlxrtel && params.r.get('ywlxrtel')) document.forms[0].ywlxrtel.value = params.r.get('ywlxrtel');
    if (document.forms[0].ywlxrtel_ && params.r.get('ywlxrtel')) document.forms[0].ywlxrtel_.value = params.r.get('ywlxrtel');
  } catch (e) { }
  
  try {
    // 企业资质审批数据回填
    if (document.forms[0].qyid && params.r.get('id')) document.forms[0].qyid.value = params.r.get('id');
    if (document.forms[0].sqdw && params.r.get('sqdw')) document.forms[0].sqdw.value = params.r.get('sqdw');
    if (document.forms[0].sqdw && params.r.get('sqdw')) document.forms[0].sqdw_.value = params.r.get('sqdw');
    if (document.forms[0].address && params.r.get('address')) document.forms[0].address.value = params.r.get('address');
    if (document.forms[0].email && params.r.get('email')) document.forms[0].email.value = params.r.get('email');
    if (document.forms[0].post && params.r.get('post')) document.forms[0].post.value = params.r.get('post');
    if (document.forms[0].ywlxr && params.r.get('ywlxr')) document.forms[0].ywlxr.value = params.r.get('ywlxr');
    if (document.forms[0].ywlxr_ && params.r.get('ywlxr')) document.forms[0].ywlxr_.value = params.r.get('ywlxr');
    if (document.forms[0].ywlxrtel && params.r.get('ywlxrtel')) document.forms[0].ywlxrtel.value = params.r.get('ywlxrtel');
    if (document.forms[0].ywlxrtel_ && params.r.get('ywlxrtel')) document.forms[0].ywlxrtel_.value = params.r.get('ywlxrtel');
    if (document.forms[0].zczj && params.r.get('zczj')) document.forms[0].zczj.value = params.r.get('zczj');
    if (document.forms[0].csmj && params.r.get('csmj')) document.forms[0].csmj.value = params.r.get('csmj');
    if (document.forms[0].frxm && params.r.get('frxm')) document.forms[0].frxm.value = params.r.get('frxm');
    if (document.forms[0].frzw && params.r.get('frzw')) document.forms[0].frzw.value = params.r.get('frzw');
    if (document.forms[0].zsbh && params.r.get('zsbh')) document.forms[0].zsbh.value = params.r.get('zsbh');
    if (document.forms[0].zzdj && params.r.get('zzdj')) document.forms[0].zzdj.value = params.r.get('zzdj');
    if (document.forms[0].gszcdjh && params.r.get('gszcdjh')) document.forms[0].gszcdjh.value = params.r.get('gszcdjh');
    if (document.forms[0].jjlx && params.r.get('jjlx')) document.forms[0].jjlx.value = params.r.get('jjlx');
    if (document.forms[0].rsJsry && params.r.get('rsJsry')) document.forms[0].rsJsry.value = params.r.get('rsJsry');
    if (document.forms[0].rsWxg && params.r.get('rsWxg')) document.forms[0].rsWxg.value = params.r.get('rsWxg');
    if (document.forms[0].rsTotal && params.r.get('rsTotal')) document.forms[0].rsTotal.value = params.r.get('rsTotal');
    if (document.forms[0].dwslJyrq && params.r.get('dwslJyrq')) document.forms[0].dwslJyrq.value = params.r.get('dwslJyrq');
    if (document.forms[0].dwslGyrq && params.r.get('dwslGyrq')) document.forms[0].dwslGyrq.value = params.r.get('dwslGyrq');
    if (document.forms[0].qyRemarks && params.r.get('qyRemarks')) document.forms[0].qyRemarks.value = params.r.get('qyRemarks');
  } catch (e) { }
  
  try {
    // 户外广告数据回填
    if (document.forms[0].qyid && params.r.get('id')) document.forms[0].qyid.value = params.r.get('id');
    if (document.forms[0].sqdw && params.r.get('sqdw')) document.forms[0].sqdw.value = params.r.get('sqdw');
    if (document.forms[0].sqdw_ && params.r.get('sqdw')) document.forms[0].sqdw_.value = params.r.get('sqdw');
    if (document.forms[0].qyname_khb && params.r.get('sqdw')) document.forms[0].qyname_khb.value = params.r.get('sqdw');
    if (document.forms[0].qyname_shb && params.r.get('sqdw')) document.forms[0].qyname_shb.value = params.r.get('sqdw');
    if (document.forms[0].address && params.r.get('address')) document.forms[0].address.value = params.r.get('address');
    if (document.forms[0].ywlxr && params.r.get('ywlxr')) document.forms[0].ywlxr.value = params.r.get('ywlxr');
    if (document.forms[0].ywlxrtel && params.r.get('ywlxrtel')) document.forms[0].ywlxrtel.value = params.r.get('ywlxrtel');
    if (document.forms[0].qylx && params.r.get('qylx')) document.forms[0].qylx.value = params.r.get('qylx');
    if (document.forms[0].frxm && params.r.get('frxm')) document.forms[0].frxm.value = params.r.get('frxm');
    if (document.forms[0].zsbh && params.r.get('zsbh')) document.forms[0].zsbh.value = params.r.get('zsbh');
  } catch (e) { }
  
  try {
    // 处置证 -- 变更换证 数据回填
    if (document.forms[0].qyid && params.r.get('id')) document.forms[0].qyid.value = params.r.get('id');
    if (document.forms[0].sqdw && params.r.get('sqdw')) document.forms[0].sqdw.value = params.r.get('sqdw');
    if (document.forms[0].qyjc && params.r.get('qyjc')) document.forms[0].qyjc.value = params.r.get('qyjc');
    if (document.forms[0].post && params.r.get('post')) document.forms[0].post.value = params.r.get('post');
    if (document.forms[0].address && params.r.get('address')) document.forms[0].address.value = params.r.get('address');
    if (document.forms[0].cz && params.r.get('cz')) document.forms[0].cz.value = params.r.get('cz');
    if (document.forms[0].frphone && params.r.get('frphone')) document.forms[0].frphone.value = params.r.get('frphone');
    if (document.forms[0].frxm && params.r.get('frxm')) document.forms[0].frxm.value = params.r.get('frxm');    
    if (document.forms[0].ywlxr && params.r.get('ywlxr')) document.forms[0].ywlxr.value = params.r.get('ywlxr');
    if (document.forms[0].ywlxrtel && params.r.get('ywlxrtel')) document.forms[0].ywlxrtel.value = params.r.get('ywlxrtel');
    if (document.forms[0].zydm && params.r.get('zydm')) document.forms[0].zydm.value = params.r.get('zydm');
    if (document.forms[0].gszcdjh && params.r.get('gszcdjh')) document.forms[0].gszcdjh.value = params.r.get('gszcdjh');
    if (document.forms[0].gszcdjyxq && params.r.get('gszcdjyxq')) document.forms[0].gszcdjyxq.value = params.r.get('gszcdjyxq');
    if (document.forms[0].qyphone && params.r.get('qyphone')) document.forms[0].qyphone.value = params.r.get('qyphone');
    if (document.forms[0].qydlyszh && params.r.get('qydlyszh')) document.forms[0].qydlyszh.value = params.r.get('qydlyszh');
    if (document.forms[0].qydlyszyxq && params.r.get('qydlyszyxq')) document.forms[0].qydlyszyxq.value = params.r.get('qydlyszyxq');
    if (document.forms[0].cls && params.r.get('cls')) document.forms[0].cls.value = params.r.get('cls');
    if (document.forms[0].czzh && params.r.get('czzh')) document.forms[0].czzh.value = params.r.get('czzh');
    if (document.forms[0].sfyx && params.r.get('sfyx')) document.forms[0].sfyx.value = params.r.get('sfyx');
    
    if (document.forms[0].gsmc && params.r.get('sqdw')) document.forms[0].gsmc.value = params.r.get('sqdw');
    
	
	
    if (document.forms[0].qylx && params.r.get('qylx')) document.forms[0].qylx.value = params.r.get('qylx');
    if (document.forms[0].frxm && params.r.get('frxm')) document.forms[0].frxm.value = params.r.get('frxm');
    if (document.forms[0].zsbh && params.r.get('zsbh')) document.forms[0].zsbh.value = params.r.get('zsbh');
  } catch (e) { }
  
	try{
	//余泥处   排放   消纳   数据回填
		if(params.r.get('templateCode') == 'jzfqwczzpf' || params.r.get('templateCode') == 'jzfqwczzxn'){
			if (document.forms[0].qyid && params.r.get('id')) document.forms[0].qyid.value = params.r.get('id');
			if (document.forms[0].jsdwDz && params.r.get('address')) document.forms[0].jsdwDz.value = params.r.get('address');
		    if (document.forms[0].jsdwLxr && params.r.get('ywlxr')) document.forms[0].jsdwLxr.value = params.r.get('ywlxr');
		    if (document.forms[0].jsdwLxrLxdh && params.r.get('ywlxrtel')) document.forms[0].jsdwLxrLxdh.value = params.r.get('ywlxrtel');
		}
	}catch(e){
		
	}
  
  // 载入企业材料信息
  /*Ext.Ajax.request({
    url: ctx + '/yw-com-sjcl!saveAndLoadSjclBySelectQyxx.action',
    params:{
      'fkid': params.r.get('id'),
      'ajid': document.forms[0].id.value,
      'tplcode': params.tplcode
    },
    success:function(response){
      if (document.forms[0].id.value == '') return;
      var sjclIframe = document.getElementById('sjcl_iframe');
      if (!sjclIframe) return;
      
      if (sjclIframe.contentWindow.applyQyclList) {
        sjclIframe.contentWindow.applyQyclList(params.r.get('id'));
      }
    },
    scope: this
  });*/
}
function validateForm(){
var reEmail=/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
 var reTel=/^[1-9]{1}[0-9]{7}$/; 
 var reZipCode=/^[0-9]{6}$/;
 var reMobile=/^[1][3,5,6,8][0-9]{9}$/;
     for (var i = 0; i < document.forms[0].elements.length; i++) {
        var element = document.forms[0].elements[i];
         if(element.required && element.reqtype != "send"){
         if(element.value==""){
          alert(element.parentNode.previousSibling.innerText+" \u4E0D\u80FD\u4E3A\u7A7A!");
          	element.value="";
           element.focus();
           return false;
         }
        }
        if(element.isNum){
         if(isNaN(element.value)){
          alert(element.parentNode.previousSibling.innerText+" \u5FC5\u987B\u4E3A\u6570\u5B57!");
          element.value="";
           element.focus();
           return false;
         }
        }
        //
        if(element.isEmail){
         if(!reEmail.test(element.value)){
          alert(element.parentNode.previousSibling.innerText+" \u7535\u5B50\u90AE\u4EF6\u683C\u5F0F\u4E0D\u6B63\u786E!");
          element.value="";
           element.focus();
           return false;
         }
        }
     }
    return true;
    
}
function validateSend(){
var reEmail=/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
 var reTel=/^[1-9]{1}[0-9]{7}$/; 
 var reZipCode=/^[0-9]{6}$/;
 var reMobile=/^[1][3,5,6,8][0-9]{9}$/;
 
     for (var i = 0; i < document.forms[0].elements.length; i++) {
        var element = document.forms[0].elements[i];
         if(element.required){
         if(element.value==""){
          alert(element.parentNode.previousSibling.innerText+" \u4E0D\u80FD\u4E3A\u7A7A!");
          	element.value="";
           element.focus();
           return false;
         }
        }
        if(element.isNum){
         if(isNaN(element.value)){
          alert(element.parentNode.previousSibling.innerText+" \u5FC5\u987B\u4E3A\u6570\u5B57!");
          element.value="";
           element.focus();
           return false;
         }
        }
        //
        if(element.isEmail){
         if(!reEmail.test(element.value)){
          alert(element.parentNode.previousSibling.innerText+" \u7535\u5B50\u90AE\u4EF6\u683C\u5F0F\u4E0D\u6B63\u786E!");
          element.value="";
           element.focus();
           return false;
         }
        }
     }


	/////////////////////////////////////////////////

	/////////////////////////////////////////////////
	var _sjclListObj = document.getElementById("sjcl_iframe");
	if(_sjclListObj != null){
		var _sjclList=_sjclListObj.contentWindow.document.getElementById("sjcl_list");
		for(var i=1;i<_sjclList.rows.length;i++){
			/**alert(i+"-"+_sjclList.rows[i].hasExists)**/
			var _childNodes=_sjclList.rows[i].cells;
			if(_sjclList.rows[i].hasExists=="false"){
				alert("*"+_childNodes[1].innerHTML+"\u6CA1\u6709\u4E0A\u4F20,\u8BF7\u5148\u4E0A\u4F20\u8BE5\u9644\u4EF6!");
				return false;
			}
		}
	}
	
    return true;
    
}
//余泥处申请表------申请事项初始化
function chooseOne(cb){  
	var obj = document.getElementsByName("sqsx");  
	for (i=0; i<obj.length; i++){  
		if (obj[i]!=cb) obj[i].checked = false;  
		else obj[i].checked = true;  
	}  
}

function selectJsdw(tplcode) {
  ExtElJsdwWin({id: 'selectJsdwWin', title: '选择建设单位', w: 950, h: 500, tplcode: tplcode});
}

function ExtElJsdwWin(f) {
  var w = 950;
  var h = 500;
  if (f.w) w = f.w;
  if (f.h) h = f.h;
  
  //查询
    var searchForm = new Ext.FormPanel({
        region: 'north',
        title: '',
        labelAlign: 'right',
        height: 100,
        frame: true,
        plain: true,
        collapsible: true,
        border: true,
        margins: '1 1 2 1',
        items: [{
            layout: 'column',
            items:[{
                columnWidth: .25,
                layout: 'form',
                items: [
                    {
	                    xtype: 'textfield',
	                    fieldLabel: '建设单位',
	                    emptyText:'请输入建设单位',
	                    name: 'jsdw',
	                    editable:false,
	                    anchor: '95%'
	                }]
                },{
                columnWidth: .25,
                layout: 'hbox',
                defaults:{margins:'0 5 0 40'},
                items:[{
                    xtype: 'button',
                    text: '&nbsp;查询',
                    width: 60,
                    iconCls: 'icon-find',
                    handler: function(){                        
                        jsdwGrid.store.load();
                    },
                    scope: this
                },{
                    xtype: 'button',
                    text: '清空',
                    width: 60,
                    handler: function(){
                        searchForm.form.reset();
                        jsdwGrid.store.load();
                    },
                    scope: this
                }]
            }]
        }]
    });
  this.searchForm = searchForm;
  
  var jsdwGrid = new Ext.ux.grid.YwGrid({
    //iconCls: 'icon-print',
    region: 'center',
    layout: 'fit',
    tplcode: f.tplcode,
    //margins: '1 1 1 1',
    //needSelectTbar: true,
    needCsdlwjSelectTbar:true,
    //needPrintBtn: true,
    url: '/yw-com-qyxx-csdlwj!dataList.action',
    keyField: 'id',
    defaultSortField: 'jsdw',
    structure: [{
      name: 'id',
      hidden: true
    },{
      name: 'jsdw',
      header: '建设单位'
    },{
      name: 'jsdwAddress',
      header: '建设单位地址'
    },{
      name: 'jsdwTel',
      header: '建设单位电话'
    },{
      name: 'fddbr',
      header: '建设单位法定代表人'
    },{
      name: 'fddbrLxr',
      header: '建设单位联系人'
    },{
      name: 'jsdwSzq',
      header: '建设单位所在区'
    }]
  });
  
  var store = jsdwGrid .store;
  var toolbar = jsdwGrid .toolbar;
  store.on('beforeload', function(){
    store.baseParams = {
      jsdw: searchForm.form.findField('jsdw').getValue()
    };
  }, this);
  
  new Ext.Window({
    id        : f.id,
    title     : f.title,
    width     : w,
    height    : h,
    iconCls   : 'icon_title',
    layout    : 'border',
    modal     : true,
    plain     : true,
    //autoDestroy : false,
    resizeable: false,
    items     : [searchForm,jsdwGrid]
  }).show();
}

function selectJsdwCallback(params) {
  try {
    // 设施改动数据回填
   // if (document.forms[0].qyid && params.r.get('id')) document.forms[0].qyid.value = params.r.get('id');
    if (document.forms[0].sqdw && params.r.get('jsdw')) document.forms[0].sqdw.value = params.r.get('jsdw');

  } catch (e) { }
 
  
  // 载入企业材料信息
  /*Ext.Ajax.request({
    url: ctx + '/yw-com-sjcl!saveAndLoadSjclBySelectQyxx.action',
    params:{
      'fkid': params.r.get('id'),
      'ajid': document.forms[0].id.value,
      'tplcode': params.tplcode
    },
    success:function(response){
      if (document.forms[0].id.value == '') return;
      var sjclIframe = document.getElementById('sjcl_iframe');
      if (!sjclIframe) return;
      
      if (sjclIframe.contentWindow.applyQyclList) {
        sjclIframe.contentWindow.applyQyclList(params.r.get('id'));
      }
    },
    scope: this
  });*/
}

function selectSgdw(tplcode) {alert(2);
  ExtElSgdwWin({id: 'selectSgdwWin', title: '选择施工单位', w: 650, h: 500, tplcode: tplcode});
}

function ExtElSgdwWin(f) {
  var w = 350;
  var h = 160;
  if (f.w) w = f.w;
  if (f.h) h = f.h;
  
  var sgdwGrid = new Ext.ux.grid.YwGrid({
    //iconCls: 'icon-print',
    region: 'center',
    layout: 'fit',
    tplcode: f.tplcode,
    //margins: '1 1 1 1',
    needSelectTbar: true,
    //needPrintBtn: true,
    url: '/yw-sr-dlwj-sqb!dataList.action',
    keyField: 'id',
    defaultSortField: 'sgdw',
    structure: [{
      name: 'id',
      hidden: true
    },{
      name: 'sgdw',
      header: '建设单位',
      width: 12
    }]
  });
  
  var store = sgdwGrid .store;
  var toolbar = sgdwGrid .toolbar;
  store.on('beforeload', function(){
    store.baseParams = {
      sgdw: toolbar.search_sqdw.getValue()
    };
  }, this);
  
  new Ext.Window({
    id        : f.id,
    title     : f.title,
    width     : w,
    height    : h,
    iconCls   : 'icon_title',
    layout    : 'fit',
    modal     : true,
    plain     : true,
    //autoDestroy : false,
    resizeable: false,
    items     : [sgdwGrid]
  }).show();
}

function selectSgdwCallback(params) {
  try {
    // 设施改动数据回填
   // if (document.forms[0].qyid && params.r.get('id')) document.forms[0].qyid.value = params.r.get('id');
    if (document.forms[0].sgdw && params.r.get('sgdw')) document.forms[0].sgdw.value = params.r.get('sgdw');

  } catch (e) { }
 }
 
 
 //城市道路挖掘---企业管理的js

function selectQyxx2(tplcode) {
  ExtElWin2({id: 'selectQyxxWin', title: '选择建设单位', w: 950, h: 660, tplcode: tplcode});
}

function ExtElWin2(f) {
  var w = 950;
  var h = 660;
  if (f.w) w = f.w;
  if (f.h) h = f.h;
  
  //查询
    var searchForm = new Ext.FormPanel({
        region: 'north',
        title: '',
        labelAlign: 'right',
        height: 100,
        frame: true,
        plain: true,
        collapsible: true,
        border: true,
        margins: '1 1 2 1',
        items: [{
            layout: 'column',
            items:[{
                columnWidth: .25,
                layout: 'form',
                items: [
                    {
	                    xtype: 'textfield',
	                    fieldLabel: '建设单位',
	                    emptyText:'请输入建设单位',
	                    name: 'jsdw',
	                    editable:false,
	                    anchor: '95%'
	                }]
                },{
                columnWidth: .25,
                layout: 'hbox',
                defaults:{margins:'0 5 0 40'},
                items:[{
                    xtype: 'button',
                    text: '&nbsp;查询',
                    width: 80,
                    iconCls: 'icon-find',
                    handler: function(){                        
                        csdlwjQyxxGrid.store.load();
                    },
                    scope: this
                },{
                    xtype: 'button',
                    text: '清空',
                    width: 80,
                    handler: function(){
                        searchForm.form.reset();
                        csdlwjQyxxGrid.store.load();
                    },
                    scope: this
                }]
            }]
        }]
    });
  this.searchForm = searchForm;
  
  var csdlwjQyxxGrid = new Ext.ux.grid.YwCsdlwjqyxx({
    //iconCls: 'icon-print',
    region: 'center',
    layout: 'fit',
    tplcode: f.tplcode,
    //margins: '1 1 1 1',
    //needSelectTbar: true,
    //needPrintBtn: true,
    url: '/yw-com-qyxx-csdlwj!dataList.action',
    keyField: 'id',
    structure: [{
      name: 'id',
      hidden: true
    },{
      name: 'jsdw',
      header: '建设单位'
    },{
      name: 'jsdwAddress',
      header: '建设单位地址'
    },{
      name: 'jsdwTel',
      header: '建设单位电话'
    },{
      name: 'fddbr',
      header: '建设单位法定代表人'
    },{
      name: 'fddbrLxr',
      header: '建设单位联系人'
    },{
      name: 'jsdwSzq',
      header: '建设单位所在区'
    }]
  });
  
  var store = csdlwjQyxxGrid.store;
  var toolbar = csdlwjQyxxGrid.toolbar;
  store.on('beforeload', function(){
    store.baseParams = {
      jsdw: searchForm.form.findField('jsdw').getValue()
    };
  }, this);
  
  new Ext.Window({
    id        : f.id,
    title     : f.title,
    width     : w,
    height    : h,
    iconCls   : 'icon_title',
    layout    : 'border',
    modal     : true,
    plain     : true,
    //autoDestroy : false,
    resizeable: false,
    items     : [searchForm,csdlwjQyxxGrid]
  }).show();
}